<template>
  <div class="app">
    <banner></banner>
    <div style="padding: 20px">
      <div style="display: flex; margin: 20px 0">
        <img class="avater" :src="detail.avatar" alt="" />
        <p class="tt" style="color: #333">{{ detail.author }}</p>
        <p class="tt" style="font-size: 16px">发表于 {{ detail.dateTime }}</p>
      </div>
      <h1>{{ detail.title }}</h1>
      <p class="detail">{{ detail.detail }}</p>
    </div>
  </div>
</template>

<script>
import Banner from "./components/banner.vue";
export default {
  data() {
    return {
      detail: [],
    };
  },
  components: { Banner },
  mounted() {
    var { id } = this.$route.params;
    this.$http(`http://47.108.197.28:4000/api/articleDetail?id=${id}`).then(
      (res) => {
        this.detail = res.data.res[0];
      }
    );
  },
};
</script>

<style scoped>
.app {
  width: 10rem;
  overflow: hidden;
  margin: auto;
}
.avater {
  width: 60px;
}
.tt {
  line-height: 60px;
  margin-right: 10px;
  color: #b2b2b2;
  font-size: 26px;
}
h1,
p {
  text-align: left;
}
.detail {
  margin-top: 50px;
  color: #b2b2b2;
  font-size: 22px;
}
</style>